package org.zjt.mock.demo.mock.service.impl;

import org.springframework.validation.annotation.Validated;
import org.zjt.mock.demo.mock.domain.User;
import org.zjt.mock.demo.mock.service.UserService;
import org.springframework.stereotype.Service;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @author juntao.zhang
 * @version V1.0
 * @Description: TODO
 * @Package or.zjt.mock.demo.mock.service.impl
 * @date 2018/6/3 16:29
 */
@Service
public class UserServiceImpl implements UserService {

    private static final List<User> users = new CopyOnWriteArrayList();

    @Override

    public void saveUser(User user) {
        users.add(user);
    }

    @Override
    public List<User> findAllUser() {
        return Collections.unmodifiableList(users);
    }
}
